package com.runvp.task;

import com.runvp.service.biz.service.IBizDeviceService;
import com.runvp.service.biz.service.IBizOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度 -订单
 *
 * @author update for xkk
 */
@Slf4j
@Component("platTask")
public class PlatTask {

    @Autowired
    private IBizOrderService bizOrderService;
    @Autowired
    private IBizDeviceService bizDeviceService;

    /**
     * 定时检测超时订单
     * @param minutes
     */
    public void testTask(Integer minutes) {
        long st = System.currentTimeMillis();
        log.info("本次测试间隔【{}】,执行时间:{}",minutes,(System.currentTimeMillis()-st)+" ms");
    }
    /**
     * 定时检测超时订单
     * @param minutes
     */
    public void checkOrder(Integer minutes) {
        long st = System.currentTimeMillis();
        bizOrderService.taskCheckOrder(minutes);
        log.info("本次超时订单检测间隔【{}】,执行时间:{}",minutes,(System.currentTimeMillis()-st)+" ms");
    }
    /**
     * 定时检测设备在线状态
     * @param minutes
     */
    public void checkDeviceOnline(Integer minutes) {
        long st = System.currentTimeMillis();
        bizDeviceService.checkDeviceOnline(minutes);
        log.info("本次检测设备在线状间隔【{}】,执行时间:{}",minutes,(System.currentTimeMillis()-st)+" ms");
    }
}
